//2644.找出可整除性得分最大的整数
//https://leetcode.cn/problems/find-the-maximum-divisibility-score/?envType=daily-question&envId=2024-05-18
class Solution {
public:
    int maxDivScore(vector<int>& nums, vector<int>& divisors) {
        int ret = 0;
        int retnum = INT_MAX;
        for(int& n:divisors)
        {
            int cnt = 0;
            for(int& k:nums)
                if(k % n == 0) ++cnt;
            
            if(cnt > ret) 
            {
                ret = cnt;
                retnum = n;
            }
            if(cnt == ret) retnum = min(retnum,n);
        }
        return retnum;
    }
};